Skip to main content

All Questions

0votes
2answers
44views

Capture and print on the exact match from a file

I am trying to use grep to match only a specific part of a row in a file. The file is a huge csv file with some columns containing json with commas so it is hard to figure out which column what I am ...
smith's user avatar
1vote
1answer
112views

How to delete a string in my files?

So I want to match all below then remove those lines of string. [MTT-5634](https://my.atlassian.net/browse/MTT-5634) [MCC-123](https://my.atlassian.net/browse/MCC-123) [MTT-7965]: https://my.atlassian....
Beelzebub's user avatar
0votes
2answers
207views

move recently created files matching a pattern from one folder to a different one

I am looking for a bash script example which does the following: I have files being written under /tmp folder I do at the xterm prompt, ls -ltr which gives me a list of recent files such as: ...
Eric's user avatar
0votes
1answer
418views

Passing arguments into a glob pattern within a script

I have a script called get_numbers.sh, which I want to use to extract data from .pdf files labelled sequentially by date, using pdfgrep. Let me simplify my problem to what I believe are its essentials:...
nonreligious's user avatar
1vote
2answers
414views

How to introduce support for command line options in a script that is written to use positional arguments?

I have a script that is currently used with positional arguments, like this: ./script.sh fname lname address I want to also support ordinary command line options when I call this script, so that I ...
Ferenc's user avatar
0votes
1answer
163views

how to use xargs to extract a list of names from IRC

Using the finch IRC client, I copy/pasted a list of names to names.txt for processing. Basically, the names are seperated by spaces. Many of the names will have special characters like "/" ...
Nicholas Saunders's user avatar
1vote
1answer
105views

Best way to access files inside of directories with common part of dirname

the title is not self-explanatory at all, but I don't know how to formulate it correctly. I will explain with an example. I have a directory structure like this: results/ test_0_part1_x000/ ...
panc_fab's user avatar
1vote
2answers
332views

Finding a string in a txt of house addresses with number ranges by passing in exact number and street names

Context I'm a postal worker (mail sorter) and am trying to write a bash script which allows me to input an exact street address and first couple letters of a street name, and have it return the ...
YMGenesis's user avatar
0votes
1answer
1kviews

macOS bash script regular expression not working as expected

I've been out of programming for more than 10 years. I have a text file that I'm trying to read the Mpbs value for the upload and download speed. Server: Iomart - Maidenhead (id = 3839) ...
Stewart Rolfe's user avatar
2votes
3answers
1kviews

Shell script, get/extract mac address from console output of command after "MAC: "

I'm trying to automatically pull out the mac address of a arduino device using a shell script, and need some help how to do this. This is the output returned by the command: Opening /dev/cu....
sMyles's user avatar
  • 2,725
1vote
1answer
88views

Trying to parse a string in BASH for [ - _ ]

I have a BASH script that allows a user to specify a jobname. Right now we except everything. We feed this jobname into another executable that can only accept the following formats: job_name, ...
bj2348's user avatar
8votes
2answers
3kviews

How to write regexp literal in match expression?

This question is about the proper way to write regular expression literals in a match expression under bash. In zsh, the match below succeeds, as I expected: % [[ ' 123 ' =~ '^ [0-9]+ $' ]]; echo $? ...
kjo's user avatar
  • 16.2k
0votes
2answers
358views

Syntax for regular expression searching for DNA codons

I have to write a script for an assignment which will take the file name as a command and output every unique 3 base codon in the file and how many times it occurs in descending order. The script has ...
Chaudry Osama's user avatar
4votes
2answers
15kviews

One liner matching filenames with regular expressions?

I have a small script. #!/bin/bash # test for regular expressions to match... DIR="/search/path/" NAME="FOO[0-9][0-9]_<bar|dog|cat>" for FILE in `find ${DIR} -maxdepth 1 -type f -name "*\.[dD][...
SHLelieveld's user avatar
-1votes
2answers
152views

Using regex in the heredocument redirect/append line, to target specific "sets" of directories

I need a way to target all sub directories under public_html which ends with .com or other TLDs like .biz or .co.il I might list, in a heredocument. This my hereoducmnet inside an pushd-popd - if-fi ...
Arcticooling's user avatar

153050per page
close